package com.yc.cloud.basic.dto;

import io.swagger.annotations.ApiModel;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

/**
 * @Description: 通用查询类
 * @Author JackGu
 * @Date: 2022/6/7 15:57
 * @Version 1.0
 */
@Data
@ApiModel
public class BaseQueryParam {

    public static final Integer DEFAULT_SIZE = 10;
    public static final Integer DEFAULT_NUM = 1;

    public static final String ORDER_DESC = "desc";
    public static final String ORDER_ASC = "asc";
    public static final String DEFAULT_SORT_BY = "id";

    @Schema(description = "查询条件")
    private String keyword;

    @Schema(example = "1",description = "第几页,默认1",defaultValue = "1")
    private Integer pageNum = DEFAULT_NUM;

    @Schema(example = "10",description = "一页显示多少数量,默认10",defaultValue = "10")
    private Integer pageSize = DEFAULT_SIZE;

    @Schema(example = "id",description = "按字段排序,默认按照ID降序",defaultValue = "id")
    private String sortBy = DEFAULT_SORT_BY;

    @Schema(example = "desc",description = "降序或升序,默认降序",defaultValue = "desc")
    private String order = ORDER_DESC;

    @Schema(example = "true",description = "是否分页,默认分页,0:不分页 1:分页",defaultValue = "true")
    private Boolean page = true;

}
